﻿<UserControl 
    x:Class="ObticsUnitTestRunner_SilverLight.MainPage"    
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:ov="clr-namespace:Obtics.Values;assembly=Obtics_Silverlight"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:local="crl-namespace:ObticsUnitTestRunner_SilverLight"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
    DataContext="{Binding RelativeSource={RelativeSource Self}, Path=ViewModel}"
    >
  <Grid x:Name="LayoutRoot">      
        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition/>
            <RowDefinition Height="100"/>
        </Grid.RowDefinitions>    
        <StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Stretch" >
            <CheckBox Margin="12,12,12,12" VerticalAlignment="Top" Content="All" IsChecked="{Binding Path=AllSelected.Value, Mode=TwoWay}" Click="CheckBox_UpdateSource" />
            <ContentControl Margin="12,12,0,12" Content="Filter:" />
            <TextBox Margin="0,12,12,12" VerticalAlignment="Top" Text="{Binding Path=FilterExpression.Value, Mode=TwoWay}" />
            <ContentControl Margin="12,12,0,12" Content="Success:" />
            <ContentControl Margin="0,12,12,12"  Content="{Binding Path=PassedCount.Value}" />
            <ContentControl Margin="12,12,0,12" Content="Failed:" />
            <ContentControl Margin="0,12,12,12" Content="{Binding Path=FailedCount.Value}" />
        </StackPanel>
        <data:DataGrid Name="MethodsGrid" Grid.Row="1" ItemsSource="{Binding Path=VisibleMethods}" AutoGenerateColumns="False" >
            <data:DataGrid.Columns>
                <data:DataGridCheckBoxColumn Header="Selected" CanUserReorder="False" Binding="{Binding Path=Selected.Value}"/>
                <!--data:DataGridTextColumn Header="Name" Binding="{Binding Path=Name}"/-->
                <data:DataGridTextColumn Header="Full name" Binding="{Binding Path=FullName}"/>
                <data:DataGridTextColumn Header="Result" Binding="{Binding Path=Result.Value}"/>
                <data:DataGridTextColumn Header="Message" Binding="{Binding Path=Message.Value}"/>
            </data:DataGrid.Columns>
        </data:DataGrid>
        <StackPanel Grid.Row="2" Orientation="Horizontal" >
            <Button Name="RunButton" VerticalAlignment="Top" Margin="12,12,12,12" Click="RunButton_Click" IsEnabled="{Binding Path=RunButtonEnabled.Value}" Content="Run" />
            <StackPanel Visibility="{Binding Path=ProgressPanelVisibility.Value}">
                <StackPanel Orientation="Horizontal">
                    <ProgressBar  Margin="12,12,12,12"  HorizontalAlignment="Left" Width="200" Height="20" Minimum="0.0" Maximum="1.0" IsIndeterminate="False" Value="{Binding Path=Progress.Value}" />
                    <Button Margin="12,12,12,12"  HorizontalAlignment="Left" Name="CancelButton" VerticalAlignment="Top" Click="CancelButton_Click" IsEnabled="{Binding Path=CancelButtonEnabled.Value}" Content="Cancel" />
                </StackPanel>
                <ContentControl Margin="12,12,12,12" Content="{Binding Path=CurrentlyRunningMethod.Value.FullName}"></ContentControl>
            </StackPanel>
        </StackPanel>
    </Grid>
</UserControl>
